package com.southwind.springboottest.repository;

import com.southwind.springboottest.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface UserRepository extends JpaRepository<User, Integer> {
    @Query(value = "SELECT * FROM `user`", nativeQuery = true)
    Page<User> findAll(Pageable pageable);
    
    @Query(value = "SELECT COUNT(userid) FROM `user`", nativeQuery = true)
    long count();
    
    User findByUsernameAndPassword(String username, String password);
}
